package cn.jeefast.modules.platform.service.impl;

import cn.jeefast.common.entity.MbResearchStepDataTemplateAnotherIndicators;
import cn.jeefast.common.utils.R;
import cn.jeefast.modules.platform.dao.MbResearchStepDataTemplateAnotherIndicators1Dao;
import cn.jeefast.modules.platform.service.MbResearchStepDataTemplateAnotherIndicators1Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author theodo
 * @since 2020-01-06
 */
@Service
public class MbResearchStepDataTemplateAnotherIndicators1ServiceImpl extends ServiceImpl<MbResearchStepDataTemplateAnotherIndicators1Dao, MbResearchStepDataTemplateAnotherIndicators> implements MbResearchStepDataTemplateAnotherIndicators1Service {

    @Autowired
    private MbResearchStepDataTemplateAnotherIndicators1Dao researchStepDataTemplateAnotherIndicators1Dao;

    @Override
    @Transactional
    public R addOrUpdate(List<MbResearchStepDataTemplateAnotherIndicators> list) {
            if (list.size()!=0){
                if(list.get(0).getAiId()!=null){
                    //批量更新
                    for (MbResearchStepDataTemplateAnotherIndicators mrsdta:list) {
                        researchStepDataTemplateAnotherIndicators1Dao.updateById(mrsdta);
                    }
                }else{
                    //批量插入
                    for (MbResearchStepDataTemplateAnotherIndicators mrsdta:list) {
                        researchStepDataTemplateAnotherIndicators1Dao.insert(mrsdta);
                    }
                }
            }
            return R.ok();
    }
}
